package com.cmyshare.design.singletonPattern;

/**
 * @version 1.0
 * @Author cmy
 * @Date 2023/9/25 21:34
 * @desc 饿汉模式，单例实例在类装载的时候（使用静态代码块）进行创建，是线程安全的
 */
public class SingletonExample6 {
    private SingletonExample6() {
    }

    private static SingletonExample6 instance = null;

    static {
        instance = new SingletonExample6();
    }

    public static SingletonExample6 getInstance() {
        return instance;
    }
}
